@extends('backend::layout')
@section('title',trans($page_title))
@section('content')
    @if(isset($search))
        {{$search->render()}}
    @endif
    @component('backend::component.table.table-content')
        @slot('page_title') {{$page_title}} @endslot
        @slot('tools_btn')

            @component('backend::component.form.button')
                @slot('title') 批量删除 @endslot
                @slot('icon') hcl-delete @endslot
                @slot('color') danger @endslot
                @slot('params') {"url":"{{route('b_GoodsTrusteeship_deleteAgent')}}","targetData":".id","title":"确定要删除委托记录吗,请点击确定","confirm":"true"} @endslot
                @slot('class') btn-ajax @endslot
            @endcomponent
            @component('backend::component.form.button')
                @slot('title') 部分顺延 @endslot
                @slot('color') primary @endslot
                @slot('class') btn-ajax @endslot
                @slot('icon') hcl-spz @endslot
                @slot('params')
                    {"prompt":{"name":"day","title":"请输入结算顺延天数"},"targetData":".id","method":"post","confirm":true,"url":"{{route('b_GoodsTrusteeship_batchPostpone')}}"}
                @endslot
            @endcomponent

            @component('backend::component.form.button')
                @slot('title') 全部顺延 @endslot
                @slot('color') info @endslot
                @slot('class') btn-ajax @endslot
                @slot('icon') hcl-yy1 @endslot
                @slot('params')
                    {"prompt":{"name":"day","title":"请输入结算顺延天数"},"method":"post","confirm":true,"url":"{{route('b_GoodsTrusteeship_postpone')}}"}
                @endslot
            @endcomponent

            @component('backend::component.form.button')
                @slot('title') 批量结算 @endslot
                @slot('color')danger @endslot
                @slot('class') btn-ajax @endslot
                @slot('icon') hcl-caiwu1 @endslot
                @slot('params')
                    {"method":"post","loading":true,"confirm":true,"title":"该操作请谨慎执行,如扔然需要执行该操作,请点击确定","url":"{{route('b_GoodsTrusteeship_salesRefund')}}","targetData":".id"}
                @endslot
            @endcomponent

        @endslot
        @slot('body_content')
            @if($list->isNotEmpty())
                <table class="list table table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>
                            @component('backend::component.checkbox')
                                @slot('name') ids-all @endslot
                            @endcomponent
                        </th>
                        <th>代售人</th><th>代售类型</th><th>投资</th><th>收益</th>
                        <th>时间</th><th>状态</th><th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($list as $value)
                        <tr>
                            <td>
                                @component('backend::component.checkbox')
                                    @slot('name') tg_id[] @endslot
                                    @slot('class') id @endslot
                                    @slot('value') {{$value->id}} @endslot
                                @endcomponent
                            </td>
                            <td class="text-more-hide">
                              {{$value->user->user_number}}[{{$value->user->real_name}}]
                                <br/>手机号:{{$value->user->user_phone}}
                            </td>
                            <td>
                               @if($value->agent_type == 1)
                                   {{get_currency()['money2']}}代售
                               @else
                                    {{get_currency()['money2']}}代售
                               @endif
                            </td>
                            <td>
                                @if($value->agent_type == 1)
                                    {{get_currency()['money2']}}:{{$value->pay_money}}
                                @else
                                    {{get_currency()['money2']}}:{{$value->pay_money}}<br/>
                                    {{get_currency()['money1']}}:{{$value->pay_cash}}
                                @endif

                            </td>
                            <td>
                                {{get_currency()['money1']}}{{$value->award_xj}}<br/>
                                {{get_currency()['money2']}}{{$value->award_gw}}
                            </td>
                            <td>{{$value->cycle_at}}</td>
                            <td>
                                @switch($value->status)
                                    @case(1) 待结算 @break
                                    @case(2) 已结算 @break
                                    @default
                                     作废
                                @endswitch
                            </td>
                            <td>
                                @component('backend::component.form.button')
                                    @slot('title') 结算 @endslot
                                    @slot('icon') hcl-caiwu1 @endslot
                                    @slot('color') info @endslot
                                    @slot('params') {"loading":true,"url":"{{route('b_GoodsTrusteeship_salesRefund',['tg_id'=>$value->id])}}","title":"确定为该会员结算销售回款吗","confirm":"true"} @endslot
                                    @slot('class') btn-ajax @endslot
                                @endcomponent

                                @component('backend::component.form.button')
                                    @slot('title') 删除 @endslot
                                    @slot('icon') hcl-delete @endslot
                                    @slot('color') danger @endslot
                                    @slot('params') {"url":"{{route('b_GoodsTrusteeship_deleteAgent',['tg_id'=>$value->id])}}","confirm":"true"} @endslot
                                    @slot('class') btn-ajax @endslot
                                @endcomponent
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                @slot('list_page')
                    {{$list->appends($search->getSearchData())->links('backend::public.pagination')}}
                @endslot
            @else
                @component('backend::public.empty_page')
                    @slot('info') 暂时没有托管商品 @endslot
                @endcomponent
            @endif
        @endslot
    @endcomponent
@endsection